/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package assignment_cp3120.ucm;

import assignment_cp3120.manager.deleteairport.DeleteAirportModel;
import assignment_cp3120.manager.deleteairport.DeleteAirportView;

/**
 * PRECONDITION: view has been loaded
 *
 * 1. User slecets a fligth to delete
 * 2. System deletes the airport
 * @author Administrator
 */
public class UCDeleteAirport implements UseCaseController {
    private DeleteAirportView view;
    private DeleteAirportModel model;

    public UCDeleteAirport(DeleteAirportView view, DeleteAirportModel model) {
        this.view = view;
        this.model = model;
    }
    public UCDeleteAirport() {
        this(new DeleteAirportView(), new DeleteAirportModel());
    }

    public void run() {
        //* 2. System deletes the airport
        model.deleteAirportByID(view.getSelectedAirport().getDep_id());
        view.clearView();
    }

}
